Skip to content

CheckBox

Sub classes

Name Children Inherits
MappedCheckBox
prettyqt.custom_widgets.editors.mappedcheckbox

    Base classes

    Name Children Inherits
    AbstractButtonMixin
    prettyqt.widgets.abstractbutton
    Abstract button widget base class, providing functionality common to buttons.
    QCheckBox
    PySide6.QtWidgets
    QCheckBox(self, text: str, /, parent: PySide6.QtWidgets.QWidget | None \= None, *, tristate: bool | None \= None) -> None

    ⋔ Inheritance diagram

    graph TD
      1721116053["widgets.CheckBox"]
      2670709832["widgets.AbstractButtonMixin"]
      829357528["widgets.WidgetMixin"]
      3227531497["core.ObjectMixin"]
      2751680898["builtins.object"]
      625385617["gui.PaintDeviceMixin"]
      4127570263["QtWidgets.QCheckBox"]
      4168111313["QtWidgets.QAbstractButton"]
      3620195106["QtWidgets.QWidget"]
      3984060476["QtCore.QObject"]
      37984305["Shiboken.Object"]
      673956333["QtGui.QPaintDevice"]
      2670709832 --> 1721116053
      829357528 --> 2670709832
      3227531497 --> 829357528
      2751680898 --> 3227531497
      625385617 --> 829357528
      2751680898 --> 625385617
      2751680898 --> 829357528
      2751680898 --> 2670709832
      4127570263 --> 1721116053
      4168111313 --> 4127570263
      3620195106 --> 4168111313
      3984060476 --> 3620195106
      37984305 --> 3984060476
      2751680898 --> 37984305
      673956333 --> 3620195106
      37984305 --> 673956333

    🛈 DocStrings

    Bases: AbstractButtonMixin, QCheckBox

    Checkbox with a text label.

    Source code in prettyqt/widgets/checkbox.py
    class CheckBox(widgets.AbstractButtonMixin, widgets.QCheckBox):
        """Checkbox with a text label."""
    
        value_changed = core.Signal(int)
    
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            self.stateChanged.connect(self.value_changed)
    
        @classmethod
        def supports(cls, instance) -> bool:
            return isinstance(instance, bool)
    
        def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
            """Set checkstate of the checkbox.
    
            Args:
                state: checkstate to use
            """
            self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
    
        def get_checkstate(self) -> constants.CheckStateStr:
            """Return checkstate.
    
            Returns:
                checkstate
            """
            return constants.CHECK_STATE.inverse[self.checkState()]
    

    get_checkstate() -> constants.CheckStateStr

    Return checkstate.

    Source code in prettyqt/widgets/checkbox.py
    def get_checkstate(self) -> constants.CheckStateStr:
        """Return checkstate.
    
        Returns:
            checkstate
        """
        return constants.CHECK_STATE.inverse[self.checkState()]
    

    set_checkstate(state: constants.CheckStateStr | constants.CheckState)

    Set checkstate of the checkbox.

    Parameters:

    Name Type Description Default
    state CheckStateStr | CheckState

    checkstate to use

    required
    Source code in prettyqt/widgets/checkbox.py
    def set_checkstate(self, state: constants.CheckStateStr | constants.CheckState):
        """Set checkstate of the checkbox.
    
        Args:
            state: checkstate to use
        """
        self.setCheckState(constants.CHECK_STATE.get_enum_value(state))
    

    :fa-brands-github: Show source on GitHub